<link href="<?php echo base_url('theme/third_party/rating/demo/css/application.css'); ?>" rel="stylesheet">
<div class="header row">
    <div class="title">
        <input type="hidden" name="default_path" value="<?php echo base_url('theme/third_party/rating/lib/img/'); ?>" />
        <input type="hidden" name="company_id" value="<?php echo $company['company_id']; ?>" />
        <h1><?php echo $company['name']; ?></h1>
        <div class=info>
            <b>Địa chỉ:</b> <?php echo $company['address']; ?> <br/>
            <table>
                <tbody><tr>
                        <td><b>Số điện thoại:</b> <?php echo $company['tel']; ?></td>
                        <td><?php if ($company['tax_code']): ?>
                            <b>Mã số thuế:</b> <?php echo $company['tax_code']; ?> 
                            <?php endif; ?>
                        </td>
                    </tr><tr>
                        <td><b>Email:</b> <a href="mailto:<?php echo $company['email']; ?>"><?php echo $company['email']; ?></a></td>
                        <td><?php if ($company['website']): ?>
                                <b>Website:</b> <?php echo $company['website']; ?>   
                            <?php endif; ?>
                        </td>
                    </tr></tbody>
            </table>
        </div>
    </div>
    <div class="right-block">
        <table>
            <tbody><tr>
                    <td><b>Ngày đăng tin:</b></td>
                    <td><?php echo date('d/m/Y', strtotime($company['created'])) ?></td>
                </tr><tr>
                    <td><b>Mã ID:</b></td>
                    <td><?php echo str_pad($company['company_id'], 11, '0', STR_PAD_LEFT) ?></td>
                </tr><tr>
                    <td><b>Lượt xem:</b></td>
                    <td><?php echo $company['viewed']; ?></td>
                </tr><tr>
                    <td><b>Đánh giá:</b></td>
                    <td>
                        <div title="Average rating: <?php echo $company['rate']; ?> stars" id="rate-result" tag="<?php echo $company['rate']; ?>"></div>
                    </td>
                </tr></tbody>
        </table>
        <div class="social">
            <div class="like">
                
            </div>
            <div class="share">
                    <img name="share" style="height:23px" src="<?php echo base_url('theme/images/frontend/share.png'); ?>">
                    <div class="share-content" style="display:none">
                        <a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; ?>" target="_blank">
                            <div class="facebook">
                                Facebook
                            </div>
                        </a>
                        <a href="http://twitter.com/home?status=<?php echo $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; ?>" target="_blank">
                            <div class="twitter">
                                Twitter
                            </div>
                        </a>
                        <a href="http://plus.google.com/share?url=<?php echo $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; ?>" target="_blank">
                            <div class="google-plus">
                                Google+
                            </div>
                        </a>
                    </div>
            </div>
            <div class="event">
                <button class="btn btn-primary">Sự kiện doanh nghiệp</button>
            </div>
        </div>
    </div>
    <div class="logo">
        <img style="width:100px; height:110px;" class="img-polaroid" src="<?php echo base_url('upload/company/logo/' . $company['user_id'] . '/' . $company['logo']); ?>">
    </div>
</div>
<div class="content row">
    <ul class="list-tab">
        <li class="list-tab-item list-tab-item-active"><a class="list-tab-item-link" href="#tab-1">Giới thiệu</a></li>
        <li class="list-tab-item"><a class="list-tab-item-link" href="#tab-2">Album</a></li>
        <li class="list-tab-item"><a class="list-tab-item-link" href="#tab-6">Video</a></li>
        <li class="list-tab-item"><a class="list-tab-item-link" href="#tab-3">Nhận xét</a></li>
        <?php if ($company['lat']): ?>
            <li class="list-tab-item"><a class="list-tab-item-link" href="#tab-4" data-lat=<?php echo $company['lat'] ?> data-lng=<?php echo $company['lng'] ?>>Bản đồ</a></li>
        <?php endif; ?>
        <?php if ($company['property']): ?>
            <li class="list-tab-item"><a class="list-tab-item-link" href="#tab-5">Tuyển dụng</a></li>
        <?php endif; ?>
    </ul>
    <div class=block-tab>
        <div id="tab-1" class="block-tab-content intro-tab" style="display: block;">
            <div class=left-column>       
                <?php $_intro_images = explode(';', $company['intro_images']); ?>
                <div id="gallery" class="nivoGallery">
                    <ul>
                        <?php if ($company['intro_video']): ?>
                            <li data-type="video" data-title="YouTube Video"><iframe width="560" height="315" src="<?php echo $company['intro_video']; ?>" frameborder="0" allowfullscreen></iframe></li>
                        <?php endif; ?>
                        <?php foreach ($_intro_images as $_intro_image): ?>
                            <?php if (!$_intro_image) continue; ?>
                            <li data-title="" data-caption=""><img src="<?php echo base_url('upload/company/intro_images/' . $company['user_id'] . '/' . $_intro_image); ?>" alt="" /></li>
                        <?php endforeach; ?>
                    </ul>
                </div>
            </div>
            <div class=right-column>
                <?php if ($company['english_name']): ?>
                    <b>Tên tiếng Anh:</b> <?php echo $company['english_name']; ?>
                <?php endif; ?>
                <table>
                    <tbody>
                        <?php if ($company['abbreviation']): ?>
                            <tr>
                                <td>Tên viết tắt:</td>
                                <td><?php echo $company['abbreviation']; ?></td>
                            </tr>
                        <?php endif; ?>
                        <?php if ($company['representative']): ?>
                            <tr>
                                <td>Người đại diện:</td>
                                <td><?php echo $company['representative']; ?></td>
                            </tr>
                        <?php endif; ?>
                        <?php if ($company['cellphone']): ?>
                            <tr>
                                <td>Di động:</td>
                                <td><?php echo $company['cellphone']; ?></td>
                            </tr>
                        <?php endif; ?>
                        <?php if ($company['charter_capital']): ?>  
                            <tr>
                                <td>Vốn điều lệ:</td>
                                <td><?php echo $company['charter_capital']; ?></td>
                            </tr>
                        <?php endif; ?>
                        <tr>
                            <td>Loại hình doanh nghiệp:</td>
                            <td><?php echo getBusinessTypes($company['business_types']); ?></td>
                        </tr><tr>
                            <td>Lĩnh vực kinh doanh:</td>
                            <td><?php echo getCompanyBusiness($company['businesses']); ?></td>
                        </tr>
                        <?php if ($company['business_license_issued_on']): ?>  
                            <tr>
                                <td>Giấy phép cấp ngày:</td>
                                <td><?php echo $company['business_license_issued_on']; ?></td>
                            </tr>
                        <?php endif; ?>
                        <?php if ($company['other_businesses']): ?>  
                            <tr>
                                <td>NN kinh doanh khác:</td>
                                <td><?php echo $company['other_businesses']; ?></td>
                            </tr>
                        <?php endif; ?>
                        <tr>
                            <td>Khu vực đăng tin:</td>
                            <td><?php echo getCity($company['posting_area']); ?></td>
                        </tr></tbody>
                </table>
                <div class="hr"></div>
                <?php echo $company['company_background']; ?>
            </div>
        </div>

        <style>
            .clip {
                position: relative;
                width: 100px;
                height: 63px;
            }
            #pikame img {
                position:absolute;
                top:0;
                left:0;
                bottom:0;
                right:0;
                margin:auto;
                max-height: 100% !important;
            }
            .pika-aniwrap {
                height: 100% !important;
            }
            .pika-stage {
                width: 626px;
                height: 100% !important;
                background-color: #FFFFFF;
            }
            .pika-stage img {
                width: auto !important;
                height: auto !important;
                margin: auto;
                display: block;
                position: absolute;
                bottom: 0;
                left: 0;
                right: 0;
                top: 0;
            }
        </style>

        <div id="tab-2" class="block-tab-content album-tab">
            <?php $_albums = explode(';', $company['album']); ?>
            <ul id="pikame" class="thumbnails">
                <?php foreach ($_albums as $_album): ?>
                    <?php if (!$_album) continue; ?>
                    <li class="img-polaroid"><img src="<?php echo base_url('upload/company/album/' . $company['user_id'] . '/' . $_album); ?>"/></li>
                <?php endforeach; ?>
            </ul> 
        </div>
        
        <div id="tab-6" class="block-tab-content album-tab">
		<?php if (isset($company['video']) && $company['video'] != "") { ?>
            <input type="hidden" name="video" value="<?php echo $company['video']; ?>"/>
            <div id="demo"></div>
		<?php } else { ?>
			Không tồn tại video nào
		<?php } ?>
        </div>

        <div id="tab-3" class="block-tab-content review-tab">
            <div class=left-column>
                <h4>Xếp hạng của người dùng</h4>
                <?php if (isset($not_login) && $not_login == 1) { ?>
                    <p style="margin: 5px 0 10px 0;color:red;">Bạn cần phải đăng nhập để Xếp hạng của người dùng!</p>
                <?php } else if (isset($rated) && $rated == 1) { ?>
                    <p style="margin: 5px 0 10px 0;">Bạn đã xếp hạng cho doanh nghiệp này.</p>
                <?php } else { ?>   
                    <div id="rate" tag="<?php echo $company['company_id']; ?>"></div>
                <?php } ?>    
                <div class="rate-error"></div>
                <h4>Đánh giá của người dùng</h4>
                <?php if (isset($not_login) && $not_login == 1) { ?>
                    <p style="margin: 5px 0 10px 0;color:red;">Bạn cần phải đăng nhập để Đánh giá của người dùng!</p>
                <?php } else { ?>
                    <textarea class="rate-comment" placeholder="Viết bình luận" onkeydown="addComment(event, '<?php echo $company['company_id']; ?>', '1')"></textarea>
                <?php } ?>
                <div class="rate-comment-error"></div>
            </div>
            <div class=right-column>
                <h4>Đánh giá của người dùng</h4>
                <div class=comment-block>
                    <?php if (isset($check_comment) && $check_comment == 0) { ?>
                        <p style="margin: 5px 0 10px 0;" name="no_comment">Chưa có đánh giá nào cho doanh nghiệp này.</p>
                    <?php } else { ?>
                        <?php for ($i = 0; $i < count($comment); $i++): ?>
                            <div class=comment-thread>
                                <?php if (isset($comment[$i]['avatar'])) { ?>    
                                    <img src="<?php echo getAvatarLink($comment[$i]['user_id'], $comment[$i]['avatar']); ?> ">
                                <?php } ?>
                                <div class="block-left">
                                    <a class=comment-thread-displayname href="#"><?php echo $comment[$i]['real_name']; ?></a>
                                    <span><?php echo date("Y/m/d H:i:s", strtotime($comment[$i]['commented_time'])); ?></span>
                                    <br />
                                    <div class=comment><?php echo nl2br(htmlspecialchars(urldecode($comment[$i]['comment']))); ?></div>
                                </div>
                            </div>
                        <?php endfor; ?>
                    <?php } ?>
                </div>
            </div>      
        </div>

        <div id="tab-4" class="block-tab-content map-tab">
            <div id="map_canvas" style="width: 940px; height: 388px"></div> 
        </div>
        <div id="tab-5" class="block-tab-content info-tab PrintArea">
            <div class=left-column>  
                <h4>Thông tin cơ bản</h4>
                <div class="hr"></div>

                <table>
                    <tbody><tr>
                            <td>Tính chất công việc:</td>
                            <td><?php echo $company['property']; ?></td>
                        </tr><tr>
                            <td>Địa điểm làm việc:</td>
                            <td><?php echo $company['work_place']; ?></td>
                        </tr><tr>
                            <td>Nghề nghiệp:</td>
                            <td><?php echo $company['career']; ?></td>
                        </tr><tr>
                            <td>Mức lương:</td>
                            <td><?php echo $company['salary']; ?></td>
                        </tr><tr>
                            <td>Chức vụ:</td>
                            <td><?php echo $company['position']; ?></td>
                        </tr><tr>
                            <td>Trình độ:</td>
                            <td><?php echo $company['level']; ?></td>
                        </tr><tr>
                            <td>Kinh nghiệm:</td>
                            <td><?php echo $company['experience']; ?></td>
                        </tr><tr>
                            <td>Hết hạn nộp hồ sơ:</td>
                            <td><?php echo $company['date']; ?></td>
                        </tr><tr>
                            <td>Số lượng cần tuyển:</td>
                            <td><?php echo $company['quantity']; ?></td>
                        </tr></tbody>
                </table>

                <h4>Mô tả công việc</h4>
                <div class="hr"></div>
                <?php echo $company['description']; ?>
            </div>
            <div class=right-column> 
                <h4>Yêu Cầu</h4>
                <div class="hr"></div>
                <?php echo $company['require']; ?>

                <h4>Quyền lợi được hưởng</h4>
                <div class="hr"></div>
                <?php echo $company['benefit']; ?>

                <h4>Hồ sơ dự tuyển</h4>
                <div class="hr"></div>
                <?php echo $company['record']; ?>
                <div class="profile">
                    <button class="btn btn-primary" onclick="printRecruiment();">In tin này</button>
                    <button class="btn btn-primary" onclick="downloadRecruitment();">Lưu tin này</button>
                    <button class="btn btn-primary">Nộp đơn</button>
                </div>
            </div>          
        </div>
    </div>
</div>
<div class="footer row">
    <ul class="thumbnails related">
        <?php for ($i = 0; $i < 4; $i++): ?>
            <li>
                <a class="thumbnail" href="#">
                    <div class="content">
                        <div class="title">Lucidchart: Diagramming</div>
                        <div title="Average rating: 4.31 stars (Liked it)">
                            <div class="rsw-starred"></div>
                            <div class="rsw-starred"></div>
                            <div class="rsw-starred"></div>
                            <div class="rsw-starred"></div>
                            <div class="rsw-unstarred"></div>
                        </div>
                    </div>
                    <div class="avatar">
                        <img width=50 height=50 src="https://lh6.googleusercontent.com/Y1m7gRLdYzRGCmQ47GaBsxjbJKSK99-wohDVbmglgB41Hkn1t5QIOuw69hSIRzuwitBtr-5dsg=s50-h50-e365">
                    </div>
                </a>
            </li>
        <?php endfor; ?>
    </ul>
</div>